package com.javabase.Object.ObjectBase;

public class OverLoadExercise02 {
    public static void main(String[] args) {
         Method1 method = new Method1();
         double res = method.max(2, 5,3);
        System.out.println(res);

    }
}

class Method1{
    public double max(int n1,int n2){
        return n1 > n2 ? n1: n2;
    }
    public double max(double n1, double n2){
        return n1 > n2 ? n1: n2;
    }
    public double max(double n1,double n2, double n3){
        if(n1>n2){
            n2=n1;
            if(n2>n3){
                return n2;
            }
        }else if(n2>n3){
            return n2;
        }else if(n3>n2){
            return n3;
        }else{
            return n1;
        }
        return -1;
    }

    //第三题也能用三元的嵌套！！
    //double max1 = n1 > n2 ? n1 :n2;
    //return max1> n3 ? max1 : n3;

}
